package day05;

import java.util.Scanner;

public class MainTest2 {
    public static void main(String[] args) {
        //循环输出数组的值
        int[] numArray = {8,4,2,1,23,344,12};
        for (int i=0; i<numArray.length;i++){
            System.out.println(numArray[i]);
        }
        //求数列中所有数值的和
        int sum = 0;
        for (int num:numArray){
            sum=sum+num;
            System.out.println(sum+" ");
        }

        System.out.println("请输入一个数：");
        Scanner input = new Scanner(System.in);
        int num = input.nextInt();
        for (int i=0; i<=numArray.length;i++){
            if (num==numArray[i]){
                System.out.println("包含");
            }else {
                System.out.println("不包含");
            }
        }


    }
}
